<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/


Route::match(['get','post'],'testFacade','FacadeTestController@index')->name('testFacade');

Route::match(['get','post'],'test','FacadeTestController@test')->name('test');

//-----------------------------------------------------------
Route::match(['get','post'],'apiTest','Api\User\UserController@index')->name('apiTest');


//--------------------------d------------------------------

//token
Route::match(['get','post'],'token','Api\User\UserController@createToken')->name('token');

//平台-商家后台登录-账号密码登录
Route::match(['get','post'],'loginByNameAndPwd','Api\User\UserController@loginByNameAndPwd')->name('loginByNameAndPwd');

//平台后台
Route::group(['prefix' => 'admin', 'middleware' => 'checkApiToken'], function () {
    //用户注册登录相关
    Route::match(['get','post'],'addUser','Api\User\UserController@addUser')->name('addUser');// 新增 用户
    Route::match(['get','post'],'editUser','Api\User\UserController@editUser')->name('editUser');// 编辑 用户
    Route::match(['get','post'],'delUser','Api\User\UserController@delUser')->name('delUser');// 删除 用户

    //商品相关
    Route::match(['get','post'],'goods/add','Api\Goods\PlatFormGoodsController@add')->name('add');// 新增商品
    Route::match(['get','post'],'goods/edit','Api\Goods\PlatFormGoodsController@edit')->name('edit');// 编辑商品
    Route::match(['get','post'],'goods/del','Api\Goods\PlatFormGoodsController@del')->name('del');// 删除商品
    Route::match(['get','post'],'goods/list','Api\Goods\PlatFormGoodsController@list')->name('list');// 商品列表(包含搜索)
    Route::match(['get','post'],'goods/upAndDown','Api\Goods\PlatFormGoodsController@upAndDown')->name('upAndDown');// 商品上架，下架
    Route::match(['get','post'],'goods/info','Api\Goods\PlatFormGoodsController@info')->name('info');// 商品详情

    //订货订单相关
    Route::match(['get', 'post'], 'business/order/list', 'Api\Order\BusinessOrderController@list')->name('business/order/list');// 平台 订货订单 列表
    Route::match(['get', 'post'], 'business/order/remark', 'Api\Order\BusinessOrderController@remark')->name('business/order/remark');// 平台 订货订单 备注
    Route::match(['get', 'post'], 'business/order/close', 'Api\Order\BusinessOrderController@close')->name('business/order/close');// 平台 订货订单 关闭
    Route::match(['get', 'post'], 'business/order/confirm', 'Api\Order\BusinessOrderController@confirm')->name('business/order/confirm');// 平台 订货订单 确认发货
    Route::match(['get', 'post'], 'business/order/info', 'Api\Order\BusinessOrderController@info')->name('business/order/info');// 平台 订货订单 详情

    //用户订单相关
    Route::match(['get', 'post'], 'buyer/order/remarkPlatForm', 'Api\Order\BuyerOrderController@remarkPlatForm')->name('buyer/order/remarkPlatForm');//平台订单备注
    Route::match(['get', 'post'], 'buyer/order/closePlatForm', 'Api\Order\BuyerOrderController@closePlatForm')->name('buyer/order/closePlatForm');//平台关闭订单
    Route::match(['get', 'post'], 'buyer/order/listPlatForm', 'Api\Order\BuyerOrderController@listPlatForm')->name('buyer/order/listPlatForm');//平台订单列表
    Route::match(['get', 'post'], 'buyer/order/infoPlatForm', 'Api\Order\BuyerOrderController@infoPlatForm')->name('buyer/order/infoPlatForm');//平台订单详情
    //系统转单应当涉及到新的派单通知，需要在通知系统实现后加入
    Route::match(['get', 'post'], 'buyer/order/transferPlatForm', 'Api\Order\BuyerOrderController@transferPlatForm')->name('buyer/order/transferPlatForm');//平台系统转单
    Route::match(['get', 'post'], 'buyer/order/riderInfoPlatForm', 'Api\Order\BuyerOrderController@riderInfoPlatForm')->name('buyer/order/riderInfoPlatForm');//获取骑手信息
    Route::match(['get', 'post'], 'buyer/order/buyerAddressPlatForm', 'Api\Order\BuyerOrderController@buyerAddressPlatForm')->name('buyer/order/buyerAddressPlatForm');//查找对应订单的用户收货地址信息

    //运营-今日特惠
    Route::match(['get', 'post'], 'platform/goods/operation/promotionList', 'Api\Goods\PlatFormGoodsController@operationPromotionList')->name('platform/goods/operation/promotionList');// 申请特惠列表
    Route::match(['get', 'post'], 'platform/goods/promotionList', 'Api\Goods\PlatFormGoodsController@promotionList')->name('platform/goods/promotionList');// 特惠列表
    Route::match(['get', 'post'], 'platform/goods/agreePromotion', 'Api\Goods\PlatFormGoodsController@agreePromotion')->name('platform/goods/agreePromotion');// 同意特惠申请

    //运营-广告管理
    Route::match(['get', 'post'], 'platform/adv/add', 'Api\Advertising\AdvController@add')->name('platform/adv/add');// 新增广告
    Route::match(['get', 'post'], 'platform/adv/edit', 'Api\Advertising\AdvController@edit')->name('platform/adv/edit');// 编辑广告
    Route::match(['get', 'post'], 'platform/adv/del', 'Api\Advertising\AdvController@del')->name('platform/adv/del');// 删除广告
    Route::match(['get', 'post'], 'platform/adv/list', 'Api\Advertising\AdvController@list')->name('platform/adv/list');//广告列表


});


//商家后台
Route::group(['prefix' => 'sellerAdmin', 'middleware' => 'checkApiToken'], function () {
    //订货订单相关
    Route::match(['get','post'],'business/order/create','Api\Order\BusinessOrderController@create')->name('business/order/create');// 商家 订货订单 新增
    Route::match(['get','post'],'business/order/list','Api\Order\BusinessOrderController@list')->name('business/order/list');// 商家 订货订单 列表
    Route::match(['get','post'],'business/order/info','Api\Order\BusinessOrderController@info')->name('business/order/info');// 商家 订货订单 详情

    //购物车相关
    Route::match(['get','post'],'business/cart/add','Api\Cart\BusinessCartController@add')->name('business/cart/add');// 商家 订货订单 加入购物车
    Route::match(['get','post'],'business/cart/edit','Api\Cart\BusinessCartController@edit')->name('business/cart/edit');// 商家 订货订单 编辑购物车
    Route::match(['get','post'],'business/cart/del','Api\Cart\BusinessCartController@del')->name('business/cart/del');// 商家 订货订单 加入删除购物车商品
    Route::match(['get','post'],'business/cart/list','Api\Cart\BusinessCartController@list')->name('business/cart/list');// 商家 订货订单 购物车列表

    //商家商品相关
    Route::match(['get', 'post'], 'business/goods/info', 'Api\Goods\BusinessGoodsController@info')->name('business/goods/info');//商家后台，商品详情
    Route::match(['get', 'post'], 'business/goods/upAndDown', 'Api\Goods\BusinessGoodsController@upAndDown')->name('business/goods/upAndDown');//商家后台，商品上架，下架
    Route::match(['get', 'post'], 'business/goods/promotion', 'Api\Goods\BusinessGoodsController@promotion')->name('business/goods/promotion');//商家后台，申请商品促销
    Route::match(['get', 'post'], 'business/goods/list', 'Api\Goods\BusinessGoodsController@list')->name('business/goods/list');//商家后台，商品列表
    Route::match(['get', 'post'], 'business/goods/sort', 'Api\Goods\BusinessGoodsController@sort')->name('business/goods/sort');//商家后台，商品排序

    //商家-用户订单相关
    Route::match(['get', 'post'], 'buyer/order/remarkBusiness', 'Api\Order\BuyerOrderController@remarkBusinessm')->name('buyer/order/remarkBusiness');//商家订单备注
    Route::match(['get', 'post'], 'buyer/order/closeBusiness', 'Api\Order\BuyerOrderController@closeBusiness')->name('buyer/order/closeBusiness');//商家关闭订单
    Route::match(['get', 'post'], 'buyer/order/listBusiness', 'Api\Order\BuyerOrderController@listBusiness')->name('buyer/order/listBusiness');//商家订单列表
    Route::match(['get', 'post'], 'buyer/order/infoBusiness', 'Api\Order\BuyerOrderController@infoBusiness')->name('buyer/order/infoBusiness');//商家订单详情
    //系统转单应当涉及到新的派单通知，需要在通知系统实现后加入
    Route::match(['get', 'post'], 'buyer/order/transferBusiness', 'Api\Order\BuyerOrderController@transferBusiness')->name('buyer/order/transferBusiness');//商家系统转单
    Route::match(['get', 'post'], 'buyer/order/riderInfoBusiness', 'Api\Order\BuyerOrderController@riderInfoBusiness')->name('buyer/order/riderInfoBusiness');//商家-获取骑手信息
    Route::match(['get', 'post'], 'buyer/order/buyerAddressBusiness', 'Api\Order\BuyerOrderController@buyerAddressBusiness')->name('buyer/order/buyerAddressBusiness');//商家-查找对应订单的用户收货地址信息

});



//买家端
Route::group(['prefix' => 'buyer', 'middleware' => 'checkApiToken'], function () {
    Route::match(['get', 'post'], 'order/create', 'Api\Order\BuyerOrderController@create')->name('order/create');//买家下单(创建订单)

});



//骑手端
Route::group(['prefix' => 'rider', 'middleware' => 'checkApiToken'], function () {

});



